﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;
using YJKArch.Utils;

namespace HYLightingEquipmentLay.BaseData
{
	public class BaseRegionData
	{
		public BaseRegionData(List<Curve> lstCurve, XYZ ptCenter)
		{
			this.m_lstBoundary.AddRange(lstCurve);
			this.m_ptRegionCenter = ptCenter;
		}

		public virtual List<Curve> GetBoundary()
		{
			return this.m_lstBoundary;
		}

		public virtual XYZ GetRegionCenter()
		{
			return this.m_ptRegionCenter;
		}

		public bool IsPointInSide(XYZ pt)
		{
			bool result = false;
			List<XYZ> list = new List<XYZ>();
			foreach (Curve curve in this.m_lstBoundary)
			{
				list.AddRange(curve.Tessellate());
			}
			if (1 == Geometry.PointInPloygon(list, pt, 0.0001, 0.0001))
			{
				result = true;
			}
			return result;
		}

		private List<Curve> m_lstBoundary = new List<Curve>();

		private XYZ m_ptRegionCenter;
	}
}
